package com.agency8x.validator;

import com.agency8x.model.AdminModel;
import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * AuthRoleValidator.
 */
public class AuthRoleValidator extends Validator {
	
	protected void validate(Controller controller) {
        this.setShortCircuit(true); 
		validateRequiredString("title", "userNameMsg", "请输入名称!");
	}
	
	protected void handleError(Controller controller) {
		controller.keepModel(AdminModel.class);
		
		String actionKey = getActionKey();
		if (actionKey.equals("/authrole/doSave"))
			controller.render("edit.html");
	}
}
